package cn.rayland.api;

/**
 * Created by Lei on 2/4/2016.
 */
public class Axis {
    public double max_feedrate;
    public double home_feedrate;
    public double steps_per_mm;
    public double length;
    public double max_acc;
    public double max_speed_change;
    public double cornerPos;
    public int endstop;
    public int endstopPol;
    public int dir;
    public int driving_voltage;

    public Axis(){

    }
    public Axis(double thisMax_feedrate, double thisHome_feedrate, double thisSteps_per_mm, double thisLength, double thisMax_acc,
                double thisMax_speed_change, double thisCornerPos, int thisEndstop, int thisEndstopPol,int thisDir,int thisVoltage)
    {
        max_feedrate = thisMax_feedrate;
        home_feedrate = thisHome_feedrate;
        steps_per_mm = thisSteps_per_mm;
        length = thisLength;
        max_acc = thisMax_acc;
        max_speed_change = thisMax_speed_change;
        cornerPos = thisCornerPos;
        endstop = thisEndstop;
        endstopPol = thisEndstopPol;
        dir = thisDir;
        driving_voltage = thisVoltage;
    }

    
	
	public String toString() {
		return "Axis [max_feedrate=" + max_feedrate + ", home_feedrate="
				+ home_feedrate + ", steps_per_mm=" + steps_per_mm
				+ ", length=" + length + ", max_acc=" + max_acc
				+ ", max_speed_change=" + max_speed_change + ", cornerPos="
				+ cornerPos + ", endstop=" + endstop + ", endstopPol="
				+ endstopPol + ", dir=" + dir + ", voltage=" + driving_voltage + "]";
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(cornerPos);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + dir;
		result = prime * result + driving_voltage;
		result = prime * result + endstop;
		result = prime * result + endstopPol;
		temp = Double.doubleToLongBits(home_feedrate);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(length);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(max_acc);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(max_feedrate);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(max_speed_change);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(steps_per_mm);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Axis other = (Axis) obj;
		if (Double.doubleToLongBits(cornerPos) != Double
				.doubleToLongBits(other.cornerPos))
			return false;
		if (dir != other.dir)
			return false;
		if (driving_voltage != other.driving_voltage)
			return false;
		if (endstop != other.endstop)
			return false;
		if (endstopPol != other.endstopPol)
			return false;
		if (Double.doubleToLongBits(home_feedrate) != Double
				.doubleToLongBits(other.home_feedrate))
			return false;
		if (Double.doubleToLongBits(length) != Double
				.doubleToLongBits(other.length))
			return false;
		if (Double.doubleToLongBits(max_acc) != Double
				.doubleToLongBits(other.max_acc))
			return false;
		if (Double.doubleToLongBits(max_feedrate) != Double
				.doubleToLongBits(other.max_feedrate))
			return false;
		if (Double.doubleToLongBits(max_speed_change) != Double
				.doubleToLongBits(other.max_speed_change))
			return false;
		if (Double.doubleToLongBits(steps_per_mm) != Double
				.doubleToLongBits(other.steps_per_mm))
			return false;
		return true;
	}

    
}
